// 1.获取元素
let bady = document.querySelector(".bady>div");
let media = document.querySelector("audio");
let _oP = document.querySelector(`[data-time="00:00"]`);
//用来控制歌词白条在哪里出现，从哪里开始动的。
let num = -32 * 2;
// 2.根据播放时间控制歌词
media.addEventListener("timeupdate",
    function() {
        let fen = parseInt(parseInt(this.currentTime) / 60);
        let miao = parseInt(this.currentTime) % 60;
        miao = miao > 9 ? miao : ('0' + miao);
        let time = "0" + fen + ':' + miao;
        let oP = document.querySelector(`[data-time="${time}"]`)
        if (oP) {
            oP.className = "color";
            if (oP != _oP) {
                bady.scrollTo({
                    left: 0,
                    top: num,
                    behavior: "smooth"
                });
                num += 32;
                _oP = oP;
            }
        }
    }
)